package com.newcoder.community.controller.advice;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.io.IOException;


@ControllerAdvice(annotations = Controller.class)
public class ExceptionAdvice {
    private  static  Logger logger = LoggerFactory.getLogger(ExceptionAdvice.class);
    @ExceptionHandler({Exception.class})
    public void  handleException(Exception e) throws IOException {
        logger.error("服务器发生异常："+e.getMessage());

    }
}
